package br.feevale.jogo.service;

import java.util.Enumeration;

import gnu.io.CommPortIdentifier;
import gnu.io.PortInUseException;
import gnu.io.SerialPort;
import gnu.io.SerialPortEvent;
import gnu.io.SerialPortEventListener;

public class CommService implements SerialPortEventListener {

	private SerialPort serialPort;
	
	public void teste() {
		Enumeration<CommPortIdentifier> portas = CommPortIdentifier.getPortIdentifiers();
		
		System.out.println("PORTAS");
		
		while (portas.hasMoreElements()) {
			System.out.println(portas.nextElement());
		}
		
		CommPortIdentifier porta = portas.nextElement();
		
		try {
			serialPort = (SerialPort) porta.open(this.getClass().getName(), 2000);
			
			
			
			
		} catch (PortInUseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	@Override
	public void serialEvent(SerialPortEvent arg0) {
		
	}
	
	
	
}
